package com.CST.controller.ys;

import com.CST.common.api.ResultObject;
import com.CST.dto.ys.OrganizationDTO;
import com.CST.service.ys.YsOrganizationInfoService;
import com.CST.vo.ys.OrganizationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * 预算编制数据-详情
 *
 * @author cw
 * @since 2023-05-15
 */
@RestController
@RequestMapping("/ysOrganizationInfo")
@Api("预算编制数据-详情")
public class YsOrganizationInfoController {

    @Autowired
    private YsOrganizationInfoService targetService;

    @ApiOperation("查询业务职能预算编制数据")
    @PostMapping("/getBusinessOrganizationInfoList")
    public ResultObject<OrganizationVO> getBusinessOrganizationInfoList(@RequestBody OrganizationDTO dto){
        return ResultObject.success(targetService.getBusinessOrganizationInfoList(dto));
    }

    @ApiOperation("查询管理职能预算编制数据")
    @PostMapping("/getManageOrganizationInfoList")
    public ResultObject<OrganizationVO> getManageOrganizationInfoList(@RequestBody OrganizationDTO dto){
        return ResultObject.success(targetService.getManageOrganizationInfoList(dto));
    }

    @PostMapping("/download_ex")
    @ApiOperation("下载模板文件，必要参数HttpServletResponse response,")
    public void download(HttpServletResponse response) {
        targetService.download(response);
    }

    @ApiOperation("导入")
    @PostMapping("/import")
    public void importExcel(MultipartFile file) {
        targetService.importExcel(file);
    }

}
